//
//  ZYLBtutton.m
//  ZYSiJi
//
//  Created by 中矿科技有限公司 on 16/12/7.
//  Copyright © 2016年 中矿科技有限公司. All rights reserved.
//

#import "ZYLBtutton.h"

@implementation ZYLBtutton

- (instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        
        self.titleLabel.font = [UIFont systemFontOfSize:15];
        [self setTitleColor:[UIColor colorFromHex:@"333333"] forState:UIControlStateNormal];
        [self setTitleColor:[UIColor colorFromHex:@"#00BBF8"] forState:UIControlStateSelected];
        [self setTitle:@"你是谁?" forState:UIControlStateNormal];
        [self setImage:[UIImage imageNamed:@"icon_select_down@2x"] forState:UIControlStateNormal];
        [self setImage:[UIImage imageNamed:@"icon_select_up@2x"] forState:UIControlStateSelected];
        [self setTitleEdgeInsets:UIEdgeInsetsMake(0,-self.imageView.frame.size.width, 0,self.imageView.frame.size.width)];
        [self setImageEdgeInsets:UIEdgeInsetsMake(0, self.titleLabel.frame.size.width, 0, -self.titleLabel.frame.size.width)];
        
    } return self;
}
-(void)setTextAndImageEdgeInsets
{
    [self setTitleEdgeInsets:UIEdgeInsetsMake(0,-self.imageView.frame.size.width, 0,self.imageView.frame.size.width)];
    [self setImageEdgeInsets:UIEdgeInsetsMake(0, self.titleLabel.frame.size.width, 0, -self.titleLabel.frame.size.width)];
}

- (instancetype)init
{
    return [self initWithFrame:(CGRect){}];
}

- (void)addlineWithLineSpacing:(CGFloat)lineSpacing
{
    UIView *view = [[UIView alloc]initWithFrame:CGRectMake(self.frame.size.width-1, lineSpacing, 1, self.frame.size.height-lineSpacing*2)];
    view.backgroundColor = [UIColor lightGrayColor];
    [self addSubview:view];
}


@end
